package Controller;

import Service.ExchangeRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.*;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/exchange")
public class ExchangeRecordController {
    @Autowired
    private ExchangeRecordService exchangeService;

    @GetMapping("/history")
    public String userRecords(@RequestParam Long userId, Model model) {
        model.addAttribute("records", exchangeService.getRecordsByUser(userId));
        return "exchange_history";
    }
}